package top.ucat.boots.example.oauth2.realm;

import org.springframework.stereotype.Service;
import top.ucat.boots.starter.oauth2.client.beans.oauth.SystemUser;
import top.ucat.boots.starter.oauth2.client.entity.OauthUserCredentials;
import top.ucat.boots.starter.oauth2.client.realm.AuthorizingRealm;

/**
 * @Auther: Jun
 * @Date: 2019/9/4 14:10
 * @Description:
 */
@Service
public class AuthorizingRealmImpl implements AuthorizingRealm {

    @Override
    public SystemUser getQRUser(OauthUserCredentials credential) {
        SystemUser<Object> user = SystemUser.builder().userId(credential.getUserId()).build();
        return user;
    }

    @Override
    public SystemUser getUserCodeUser(OauthUserCredentials credential) {
        SystemUser<Object> user = SystemUser.builder().userId(credential.getUserId())
                .build();
        return user;
    }

    @Override
    public SystemUser getPhoneVerificationCodeUser(OauthUserCredentials credential) {
        return null;
    }
}
